const server = require('express')();
const bodyParser = require('body-parser');
const main = require('./routes/main')
const path = require('path')

server.use(bodyParser.urlencoded({extended : false}))
server.use(bodyParser.json())




server.all('*', function (req, res, next) {
    res.header('Access-Control-Allow-Origin', '*');
    res.header('Access-Control-Allow-Headers', 'Content-Type');
    res.header('Access-Control-Allow-Methods', '*');
    res.header("Access-Control-Allow-Credentials", "true");
    res.header('Content-Type', 'application/json;charset=utf-8');
    next();
});

//委托main进行路由
server.use('/',main)
server.listen(8888)